package net.pws.oos.biz.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "s_indicator_value")
public class IndicatorValue extends Identifier {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5771309308685064581L;

	public IndicatorValue() {
		super();
		// TODO Auto-generated constructor stub
	}

	public IndicatorValue(String id,String name) {
		super();
		this.setId(id);
		this.name = name;
	}

	private String name;
    
//    private String account;
//    
//    private String mobile;
    
    private Boolean enabled = Boolean.TRUE;
    
//    private String password;
    
    private String description;
    
//    @Column(name = "privileged")
//    private Boolean privileged = Boolean.FALSE;
//    
//    @Column(name = "mobile_access_allowed")
//    private Boolean mobileAccessAllowed = Boolean.FALSE;
//    
//    @Column(name = "web_access_allowed")
//    private Boolean webAccessAllowed = Boolean.FALSE;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "indicator_id")
    private Indicator indicator;
    
//    @ManyToMany(mappedBy = "users", cascade = CascadeType.PERSIST)
//    private Set<Role> roles = new HashSet<Role>();
    
    @Column(name = "has_deleted")
    private Boolean deleted = Boolean.FALSE;
//    
//    @Column(name = "source_id")
//    private String sourceId;
//    
//    @Column(name = "source_system")
//    private String sourceSystem;
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creator_id")
	private User creator;
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "create_organ_id")
	private Organization createOrganization;

	@Column(name = "create_datetime")
	private Date createDateTime;
	
	@Column(name = "delete_datetime")
	private Date deleteDateTime;

    @Column(name = "sort_num")
	private int sortNum;
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public static boolean isEnabled(IndicatorValue user) {
        return (user.getEnabled() == null) ? false : user.getEnabled()
                                                         .booleanValue();
    }
    
    public Boolean getEnabled() {
        return enabled;
    }
    
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public Indicator getIndicator() {
        return indicator;
    }
    
    public void setIndicator(Indicator indicator) {
        this.indicator = indicator;
    }
    
    public Boolean getDeleted() {
        return deleted;
    }
    
    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public Organization getCreateOrganization() {
		return createOrganization;
	}

	public void setCreateOrganization(Organization createOrganization) {
		this.createOrganization = createOrganization;
	}

	public Date getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Date createDateTime) {
		this.createDateTime = createDateTime;
	}

	public Date getDeleteDateTime() {
		return deleteDateTime;
	}

	public void setDeleteDateTime(Date deleteDateTime) {
		this.deleteDateTime = deleteDateTime;
	}

	public int getSortNum() {
		return sortNum;
	}

	public void setSortNum(int sortNum) {
		this.sortNum = sortNum;
	}

}
